<%@ page language="java" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="/doc/tag" prefix="DOC" %>
<%@ taglib uri="/pf/tag" prefix="PF" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <base href="<PF:basePath/>"/>
    <title>创建图谱-<PF:ParameterValue key="config.sys.title"/></title>
    <meta name="description"
          content='<PF:ParameterValue key="config.sys.mate.description"/>'>
    <meta name="keywords"
          content='<PF:ParameterValue key="config.sys.mate.keywords"/>'>
    <meta name="author"
          content='<PF:ParameterValue key="config.sys.mate.author"/>'>
    <meta name="robots" content="noindex,nofllow">
    <jsp:include page="../atext/include-web.jsp"></jsp:include>
    <link rel="stylesheet"
          href="<PF:basePath/>text/lib/kindeditor/themes/default/default.css"/>
    <script charset="utf-8"
            src="<PF:basePath/>text/lib/kindeditor/kindeditor-all.js"></script>
    <script charset="utf-8" src="<PF:basePath/>text/lib/kindeditor/zh_CN.js"></script>
    <link rel="stylesheet"
          href="<PF:basePath/>text/lib/kindeditor/wcpplug/wcp-kindeditor.css"/>
    <script charset="utf-8"
            src="<PF:basePath/>text/lib/kindeditor/wcpplug/wcp-kindeditor.js"></script>
    <script charset="utf-8"
            src="<PF:basePath/>text/lib/super-validate/validate.js"></script>
</head>
<body>
<jsp:include page="../commons/head.jsp"></jsp:include>
<jsp:include page="../commons/superContent.jsp"></jsp:include>
<div class="containerbox">
    <div class="container ">
        <div class="row  column_box ">
            <div class="col-md-12">
                <div class="row">
                    <div class="col-md-12">
                        <ol class="breadcrumb">
                            <li class="active">信仰知识图谱</li>
                            <li class="active">创建图谱节点</li>
                        </ol>
                    </div>
                </div>
                <form role="form" action="graph/entity/add.do" id="graphEntitySubmitFormId"
                      method="post">
                    <div class="row">
                        <div class="col-md-6">
                            <div class="form-group">
                                <label for="graphName"> 节点名称 <span
                                        class="alertMsgClass">*</span></label>
                                <input type="text" class="form-control" name="name" id="graphName"
                                       placeholder="输入节点名称"/>
                            </div>
                        </div>
                        <div class="col-md-6">
                            <div class="form-group">
                                <label for="graphLabel"> 类别 </label>
                                <input type="text" class="form-control" id="graphLabel" name="labels"
                                    placeholder="输入类别标签(如果没有系统将自动创建)"/>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-12">
                            <label for="graphDesc"> 描述 </label>
                            <textarea name="desc" id="graphDesc"
                                          style="height: 240px; width: 100%;"></textarea>
                        </div>
                    </div>
                    <div class="row column_box">
                        <div class="col-md-2">
                            <button type="button" id="graphEntitySubmitButtonId"
                                    class="btn btn-info">提交
                            </button>
                        </div>
                        <div class="col-md-10">
                            <span class="alertMsgClass" id="errormessageShowboxId"></span>
                        </div>
                    </div>
                    <div class="row column_box">
                        <div class="col-md-12"></div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<jsp:include page="/view/web-simple/type/commons/includeChooseTypes.jsp"></jsp:include>
<!-- /.modal -->
<jsp:include page="../commons/foot.jsp"></jsp:include>
</body>
<script type="text/javascript">
    var editor = null;
    $(function () {
        editor = KindEditor.create('textarea[id="graphDesc"]', {
            resizeType: 1,
            cssPath: '<PF:basePath/>text/lib/kindeditor/editInner.css',
            formatUploadUrl: false,
            allowPreviewEmoticons: false,
            allowImageUpload: false,
            items: ['undo', 'redo', '|', 'cut', 'copy', 'paste', 'plainpaste'],
        });
        $('#graphEntitySubmitButtonId')
            .bind(
                'click',
                function () {
                    editor.sync();
                    if (!validate('graphEntitySubmitFormId')) {
                        $('#errormessageShowboxId').text('信息录入有误，请检查！');
                    } else {
                        if (confirm("是否提交数据?")) {
                            $('#graphEntitySubmitFormId').submit();
                            $('#graphEntitySubmitButtonId').hide();
                            $('#graphEntitySubmitButtonId')
                                .before(
                                    "<h2><span class='label label-info glyphicon glyphicon-link'>提交中...</span></h2>");
                        }
                    }
                });
        validateInput('graphName', function (id, val, obj) {
            // 分类
            if (valid_isNull(val)) {
                return {
                    valid: false,
                    msg: '不能为空'
                };
            }
            return {
                valid: true,
                msg: '正确'
            };
        });
    });
</script>
</html>